﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using StandardsTableAdapters;

[System.ComponentModel.DataObject]
public class StandardsBLL
{
    ILE_Global ileGlobal = new ILE_Global();

    private StandardsTableAdapter _adapter = null;
    protected StandardsTableAdapter Adapter
    {
        get
        {
            if (_adapter == null)
                _adapter = new StandardsTableAdapter();

            return _adapter;
        }
    }

    [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Select, true)]
    public Standards.StandardsDataTable GetStandards()
    {
        return Adapter.GetStandards();
    }

    [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Select, false)]
    public Standards.StandardsRow GetStandardByID(int StandardID)
    {
        try
        {
            return Adapter.GetStandardByID(StandardID)[0];
        }
        catch (Exception ex)
        {
            ileGlobal.RecordError("StandardsBLL:GetStandardByID:000 Failed to get Standard row", ex, 5);
            return null;
        }
    }
    public string ConvertStandardIdToStandard(int StandardID)
    {
        try
        {
            return Adapter.GetStandardByID(StandardID)[0].Standard.ToString();
        }
        catch (Exception ex)
        {
            ileGlobal.RecordError("StandardsBLL:GetStandardByID:000 Failed to get Standard row", ex, 5);
            return null;
        }
    }
}